﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using Spring.Context;
using Spring.Context.Support;
using System.Text;
using NHibernate.ByteCode;
using RealIce.Server.Data.RealIce.Entity;


public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TablaPRUEBA1 leo = new TablaPRUEBA1("dic5",98);
        TablaPRUEBA2 t2 = new TablaPRUEBA2(3,45);
        ISession sesion = RealIce.Server.Data.RealIce.NHibernate.NHibernate.GetCurrentSession();
        ITransaction transaccion = null;


        try
        {
            transaccion = sesion.BeginTransaction();
            Console.WriteLine(sesion.IsOpen);
            sesion.Save(leo);
            sesion.Save(t2);
            Console.WriteLine("commit");
            transaccion.Commit();
            sesion.Flush();
            sesion.Close();
        }
        catch (Exception)
        {
            if (transaccion != null)
            {
                Console.WriteLine(transaccion.IsActive);
                transaccion.Rollback();
                throw;
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
    }
}
